/**
 * 模拟上传文件接口
 * @param {File} file
 */
import { local } from '@/utils/jcore/storage'
import { uploadFile } from '@/apiList/api_file'
import { fileServerPath } from '@/config/app'
function getAllImgPath(fid) {
  return `${fileServerPath}/oss/downloadFile?fid=${fid}`
}
export async function uploadFileApi(file) {
  console.log(file);
  // 直接转为本地链接 模拟上传操作
  const f = new FormData()
  f.append('file', file)
  f.append('creator', local.get('authorityList').id)
  // const imgUrl = URL.createObjectURL(file)
  const res = await uploadFile(f)
  const fid = res.fileInfos[0].fid
  const filePath = getAllImgPath(fid)
  return filePath
}
